package com.feeyin.radar.crm.model;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class SubContractCase {

	private Integer id;
	private String caseId;
	private String applicationCode;
	private String caseCode;
	private String description;
	private Double costValue;
	private Double operationCost;
	private Double officialCost;
	private Double proxyCost;
	private Date applicationDate;
	private Date modifyDate;
	private String suffixCaseName;
	private String mark;
	private ContractCase contractCase;
	private String typeId;
	
	private Long attachId;
	List<CaseAttach> attaches;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getCaseId() {
		return caseId;
	}
	public void setCaseId(String caseId) {
		this.caseId = caseId;
	}
	public String getApplicationCode() {
		return applicationCode;
	}
	public void setApplicationCode(String applicationCode) {
		this.applicationCode = applicationCode;
	}
	public String getCaseCode() {
		return caseCode;
	}
	public void setCaseCode(String caseCode) {
		this.caseCode = caseCode;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Double getCostValue() {
		return costValue;
	}
	public void setCostValue(Double costValue) {
		this.costValue = costValue;
	}
	public Double getOperationCost() {
		return operationCost;
	}
	public void setOperationCost(Double operationCost) {
		this.operationCost = operationCost;
	}
	public Double getOfficialCost() {
		return officialCost;
	}
	public void setOfficialCost(Double officialCost) {
		this.officialCost = officialCost;
	}
	public Double getProxyCost() {
		return proxyCost;
	}
	public void setProxyCost(Double proxyCost) {
		this.proxyCost = proxyCost;
	}
	public String getApplicationDate() {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if(applicationDate==null)
			applicationDate = new Date();
		return sdf.format(applicationDate).toString();
	}
	public void setApplicationDate(Date applicationDate) {
		this.applicationDate = applicationDate;
	}
	public Date getModifyDate() {
		return modifyDate;
	}
	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}
	public String getSuffixCaseName() {
		return suffixCaseName;
	}
	public void setSuffixCaseName(String suffixCaseName) {
		this.suffixCaseName = suffixCaseName;
	}
	public String getMark() {
		if(mark==null||"".equals(mark)){
			if (contractCase != null && contractCase.getCaseCode() != null
					&& !"".equals(contractCase.getCaseCode())
					&& contractCase.getContractCaseType() != null
					&& !"".equals(contractCase.getContractCaseType().getId())) {
				return "sub_"+contractCase.getCaseCode()+"_"+contractCase.getContractCaseType().getId();
			}
		}
		return mark;
	}
	public void setMark(String mark) {
		this.mark = mark;
	}
	public ContractCase getContractCase() {
		return contractCase;
	}
	public void setContractCase(ContractCase contractCase) {
		this.contractCase = contractCase;
	}
	public String getTypeId() {
		return typeId;
	}
	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	public Long getAttachId() {
		return attachId;
	}
	public void setAttachId(Long attachId) {
		this.attachId = attachId;
	}
	public List<CaseAttach> getAttaches() {
		if(attaches==null)
			attaches = new ArrayList<CaseAttach>();
		return attaches;
	}
	public void setAttaches(List<CaseAttach> attaches) {
		this.attaches = attaches;
	}
}
